package main

import "fmt"

func main() {
	var a= [3][3]int{{1, 2, 3},{4, 5, 6}, {7, 8, 9}}
	var b = [3][3]int{{2, 4, 6},{8, 10, 12}, {14, 16, 18}}
	var sum = [3][3]int{}
	var acc = [3][3]int{}
	for i := 0; i < len(a); i++{
		for j := 0; j < len(a[0]); j++{
			sum[i][j] = a[i][j] + b[i][j]
			for e:=0; e < 3; e++{
				acc[i][j] = a[i][e] * b[e][j] + acc[i][j]
			}
		}
	}
	fmt.Printf("矩阵a和矩阵b相加为%v\n",sum)
	fmt.Printf("矩阵a和矩阵b相乘为%v\n",acc)
}
